home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Software / Trial / TestTrack Pro 6 / ttprowininstall.exe / %LSMAINDIR% / LicenseServer Help / wwhelp / wwhimpl / js / scripts / outlsafe.js < prev    next >
Encoding:
JavaScript  |  2003-12-12  |  5.4 KB  |  190 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHOutlineImagingSafe_Object()
  5. {
  6.   this.mIterator    = new WWHOutlineIterator_Object(true);
  7.   this.mImageSrcDir = WWHOutlineImaging_ImageSrcDir();
  8.   this.mEventString = WWHPopup_EventString();
  9.   this.mHTMLSegment = new WWHStringBuffer_Object();
  10.  
  11.   this.fGetIconURL     = WWHOutlineImaging_GetIconURL;
  12.   this.fGetPopupAction = WWHOutlineImaging_GetPopupAction;
  13.   this.fGetLink        = WWHOutlineImaging_GetLink;
  14.  
  15.   this.fGenerateStyles = WWHOutlineImagingSafe_GenerateStyles;
  16.   this.fReset          = WWHOutlineImagingSafe_Reset;
  17.   this.fAdvance        = WWHOutlineImagingSafe_Advance;
  18.   this.fOpenLevel      = WWHOutlineImagingSafe_OpenLevel;
  19.   this.fCloseLevel     = WWHOutlineImagingSafe_CloseLevel;
  20.   this.fSameLevel      = WWHOutlineImagingSafe_SameLevel;
  21.   this.fDisplayEntry   = WWHOutlineImagingSafe_DisplayEntry;
  22.   this.fUpdateEntry    = WWHOutlineImagingSafe_UpdateEntry;
  23.   this.fRevealEntry    = WWHOutlineImagingSafe_RevealEntry;
  24. }
  25.  
  26. function  WWHOutlineImagingSafe_GenerateStyles()
  27. {
  28.   var  StyleBuffer = new WWHStringBuffer_Object();
  29.   var  MaxLevel;
  30.   var  Level;
  31.  
  32.  
  33.   StyleBuffer.fAppend("<style type=\"text/css\">\n");
  34.   StyleBuffer.fAppend(" <!--\n");
  35.   StyleBuffer.fAppend("  a { text-decoration: none ;\n");
  36.   StyleBuffer.fAppend("      color: " + WWHFrame.WWHJavaScript.mSettings.mTOC.mEnabledColor + " }\n");
  37.   StyleBuffer.fAppend("  p { margin-top: 1pt ;\n");
  38.   StyleBuffer.fAppend("      margin-bottom: 1pt ;\n");
  39.   StyleBuffer.fAppend("      " + WWHFrame.WWHJavaScript.mSettings.mTOC.mFontStyle + " }\n");
  40.   for (MaxLevel = WWHFrame.WWHOutline.mMaxLevel, Level = 0 ; Level <= MaxLevel ; Level++)
  41.   {
  42.     StyleBuffer.fAppend("  p.l" + Level + " { margin-left: " + (WWHFrame.WWHJavaScript.mSettings.mTOC.mIndent * Level) + "pt }\n");
  43.   }
  44.   StyleBuffer.fAppend(" -->\n");
  45.   StyleBuffer.fAppend("</style>\n");
  46.  
  47.   return StyleBuffer.fGetBuffer();
  48. }
  49.  
  50. function  WWHOutlineImagingSafe_Reset()
  51. {
  52.   this.mIterator.fReset(WWHFrame.WWHOutline.mTopEntry);
  53. }
  54.  
  55. function  WWHOutlineImagingSafe_Advance(ParamMaxHTMLSegmentSize)
  56. {
  57.   var  Entry;
  58.  
  59.  
  60.   this.mHTMLSegment.fReset();
  61.   while (((ParamMaxHTMLSegmentSize == -1) ||
  62.           (this.mHTMLSegment.fSize() < ParamMaxHTMLSegmentSize)) &&
  63.          (this.mIterator.fAdvance(this)))
  64.   {
  65.     Entry = this.mIterator.mEntry;
  66.  
  67.     // Process current entry
  68.     //
  69.     if (Entry.mbShow)
  70.     {
  71.       this.mHTMLSegment.fAppend(this.fDisplayEntry(Entry));
  72.     }
  73.   }
  74.  
  75.   return (this.mHTMLSegment.fSize() > 0);  // Return true if segment created
  76. }
  77.  
  78. function  WWHOutlineImagingSafe_OpenLevel()
  79. {
  80. }
  81.  
  82. function  WWHOutlineImagingSafe_CloseLevel()
  83. {
  84. }
  85.  
  86. function  WWHOutlineImagingSafe_SameLevel()
  87. {
  88. }
  89.  
  90. function  WWHOutlineImagingSafe_DisplayEntry(ParamEntry)
  91. {
  92.   var  EntryHTML = "";
  93.   var  IconURL = this.fGetIconURL(ParamEntry);
  94.  
  95.  
  96.   if (ParamEntry.mChildren == null)
  97.   {
  98.     EntryHTML += "<p class=l" + ParamEntry.mLevel + ">";
  99.     EntryHTML += "<nobr>";
  100.     EntryHTML += this.fGetLink(ParamEntry, "<img width=17 height=17 border=0 src=\"" + IconURL + "\"> ");
  101.     EntryHTML += "</nobr>";
  102.     EntryHTML += "</p>\n";
  103.   }
  104.   else
  105.   {
  106.     if (ParamEntry.mbExpanded)
  107.     {
  108.       EntryHTML += "<p class=l" + ParamEntry.mLevel + ">";
  109.       EntryHTML += "<nobr>";
  110.       EntryHTML += "<a href=\"javascript:fC(" + ParamEntry.mID + ");\" " + this.fGetPopupAction(ParamEntry) + ">";
  111.       EntryHTML += "<img width=17 height=17 border=0 src=\"" + IconURL + "\"></a>";
  112.       EntryHTML += " " + this.fGetLink(ParamEntry, null);
  113.       EntryHTML += "</nobr>";
  114.       EntryHTML += "</p>\n";
  115.     }
  116.     else
  117.     {
  118.       EntryHTML += "<p class=l" + ParamEntry.mLevel + ">";
  119.       EntryHTML += "<nobr>";
  120.       EntryHTML += "<a href=\"javascript:fE(" + ParamEntry.mID + ");\" " + this.fGetPopupAction(ParamEntry) + ">";
  121.       EntryHTML += "<img width=17 height=17 border=0 src=\"" + IconURL + "\"></a>";
  122.       EntryHTML += " " + this.fGetLink(ParamEntry, null);
  123.       EntryHTML += "</nobr>";
  124.       EntryHTML += "</p>\n";
  125.     }
  126.   }
  127.  
  128.   return EntryHTML;
  129. }
  130.  
  131. function  WWHOutlineImagingSafe_UpdateEntry(ParamEntry)
  132. {
  133.   var  EntryURL;
  134.  
  135.  
  136.   // Save/restore current position
  137.   //
  138.   WWHFrame.WWHJavaScript.mPanels.fSaveScrollPosition();
  139.  
  140.   // Close down any popups we had going to prevent JavaScript errors
  141.   //
  142.   WWHFrame.WWHJavaScript.mPanels.mPopup.fHide();
  143.  
  144.   // Reload page to display expanded/collapsed entry
  145.   //
  146.   WWHFrame.WWHJavaScript.mPanels.fDisplayPanel();
  147. }
  148.  
  149. function  WWHOutlineImagingSafe_RevealEntry(ParamEntry,
  150.                                             bParamVisible)
  151. {
  152.   var  ParentEntry;
  153.   var  LastClosedParentEntry = null;
  154.  
  155.  
  156.   // Expand out enclosing entries
  157.   //
  158.   ParentEntry = ParamEntry.mParent;
  159.   while (ParentEntry != null)
  160.   {
  161.     if ( ! ParentEntry.mbExpanded)
  162.     {
  163.       ParentEntry.mbExpanded = true;
  164.       LastClosedParentEntry = ParentEntry;
  165.     }
  166.  
  167.     ParentEntry = ParentEntry.mParent;
  168.   }
  169.  
  170.   // Set target entry
  171.   //
  172.   WWHFrame.WWHOutline.mPanelAnchor = "t" + ParamEntry.mID;
  173.  
  174.   // Update display
  175.   //
  176.   if (bParamVisible)
  177.   {
  178.     // Update display if entry not already visible
  179.     //
  180.     if (LastClosedParentEntry != null)
  181.     {
  182.       this.fUpdateEntry(ParamEntry);
  183.     }
  184.  
  185.     // Display target
  186.     //
  187.     WWHFrame.WWHJavaScript.mPanels.fJumpToAnchor();
  188.   }
  189. }
  190.